package com.io;

import java.io.UnsupportedEncodingException;

/**
 * @author weijingchen
 * @DateTime 2025-06-17
 */
public class Test02 {
    public static void main(String[] args) throws UnsupportedEncodingException {
        //编码
        String a = "Hello worden";
        //默认编码
        byte[] bytes1 = a.getBytes();
        //指定字符集编码方式
        byte[] bytes2 = a.getBytes("GBK");

        System.out.println(new String(bytes1));
        //解码
        System.out.println(new String(bytes2, "GBK"));

    }
}
